import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yysk_app/pages/nft_pages/home_pages/news_detail/news_detail_page.dart';
import 'package:yysk_app/utils/colors.dart';
import 'package:yysk_app/utils/helper.dart';

class AnnouncementItemWidget extends StatelessWidget {
  final dynamic item;
  const AnnouncementItemWidget({super.key, required this.item});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        Get.toNamed(
          NewsDetailPage.path,
          arguments: {
            'id': item.id,
            'content': item.content,
            'title': item.title,
             'labelName': item.labelName,
            'createTime': item.createTime,
          },
        );
      },
      child: Container(
        padding: EdgeInsets.all(16.px),
        margin: EdgeInsets.only(top: 16.px),
        width: context.width,
        decoration: BoxDecoration(
          color: AppColors.backgroundColorGrey2,
          borderRadius: BorderRadius.circular(8.px),
        ),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Row(
              children: [
                SizedBox(
                  width: 300.px,
                  child: Text(
                  '${item.title??''}',
                  style: TextStyle(
                    color: AppColors.grey100,
                    fontSize: 14.px,
                    fontWeight: FontWeight.w700,
                    overflow: TextOverflow.ellipsis
                  ),
                ),
                ),
              ],
            ),
            SizedBox(height: 8.px),
            
            Container(
              width: context.width,
              margin: EdgeInsets.fromLTRB(0, 14.px, 0, 14.px),
              color: AppColors.backgroundColorGrey,
              height: 1.px,
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
               '${item.createTime}',
              maxLines: 2,
              overflow: TextOverflow.ellipsis,
              textAlign: TextAlign.left,
              style: TextStyle(
                color: AppColors.fontColorGrey,
                fontSize: 13.px,
                fontWeight: FontWeight.bold,
              ),
            ),
                Row(
                  children: [Text(
                  '查看详情',
                  style: TextStyle(
                    color: AppColors.fontColorGrey,
                    fontSize: 13.px,
                  ),
                ),
                SizedBox(width: 4.px),
                Icon(
                  Icons.chevron_right_outlined,
                  color: AppColors.fontColorGrey,
                  size: 14.px,
                ),],
                )
              ],
            ),
          ],
        ),
      ),
    );
  }
}
